using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace Common
{
    public partial class HandEvaluator
    {

        #region Random Enumerators

        static private Random srand = new Random();

        static public ulong RandomHand(ulong dead, int ncards)
        {
            ulong mask = 0;
            ulong card;
            for (int i = 0; i < ncards; i++)
            {
                do
                {
                    int num = srand.Next(52);
                    card = (1UL << num);
                } while (((dead | mask) & card) != 0);
                mask |= card;
            }
            return mask;
        }

        static IEnumerable<ulong> RandomHands(ulong dead, int ncards, int trials)
        {
            for (int count = 0; count < trials; count++)
            {
                yield return RandomHand(dead, ncards);
            }
        }

        #endregion
    }
}